import { exec } from 'child_process'

// 目标路径
const targetPath = 'E:\\huyuanbiao\\pc\\LL002-ZHR-WEB-FRONTEND';

// 构建命令
const command = `npm run build`;

const runExecBuild = () => {
    return new Promise((resolve, reject) => {
        exec(command, { cwd: targetPath, encoding: 'utf-8' }, (error, stdout, stderr) => {
            if (error) {
                console.log(`执行命令时出错: ${error}`);
                reject()
            }
            console.log(`命令输出: ${stdout}`);
            resolve()
        });
    })
}

// 执行命令
export const runBuild = async () => {
    await runExecBuild()
}

